﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DTcms.Common;

namespace DTcms.Web
{
    public partial class get_token : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Unnamed1_Click(object sender, EventArgs e)
        {
            //获取融云token
            string portraitUri = "http://www.shicaiquanzi.com/images/default_avatar.png";
            string appKey = "cpj2xarlc18dn";
            string appSecret = "trv6Ul2CDcxsr";
            string _mobile = "18263338026";
            string _user_name = "chuangcheng";

            String postStr = "";
            postStr += "userId=" + HttpUtility.UrlEncode(_mobile, Encoding.UTF8) + "&";
            postStr += "name=" + HttpUtility.UrlEncode(_user_name, Encoding.UTF8) + "&";
            postStr += "portraitUri=" + HttpUtility.UrlEncode(portraitUri == null ? "" : portraitUri, Encoding.UTF8) + "&";
            postStr = postStr.Substring(0, postStr.LastIndexOf('&'));
            string result = RongyunHelper.ExecutePost(appKey, appSecret, "http://api.cn.ronghub.com/user/getToken.json", postStr, "application/x-www-form-urlencoded");

            Response.Write(result);
        }
    }
}